import {
  IResponse,
  Banner,
  SongList,
  BroadCastItem,
  HomeNewSong,
  MVModel,
} from "@/types/index";

import request from "../utils/request";

export function getRecommendNewSongs(limit?: number) {
  return request<{
    code: number;
    category: number;
    result: HomeNewSong[];
  }>({
    url: "/personalized/newsong",
    method: "get",
    params: { limit },
  });
}

export function homeDiscovery() {
  return request({
    url: "/homepage/block/page",
    method: "get",
  });
}

export function getBanner() {
  return request<{ code: number; banners: Banner[] }>({
    url: "/banner",
    method: "get",
    params: { type: 0 },
  });
}

export function getRecommendSongList(limit: number = 30) {
  return request<{
    category: number;
    code: number;
    hasTaste: boolean;
    result: SongList[];
  }>({
    url: "/personalized",
    method: "get",
    params: { limit },
  });
}

export function getPrivateContent() {
  return request<{
    code: number;
    name: string;
    result: BroadCastItem[];
  }>({
    url: "/personalized/privatecontent",
    method: "get",
  });
}

export function getRecommendMV(limit?: number) {
  return request<{
    code: number;
    result: MVModel[];
    category: number;
  }>({
    url: "/personalized/mv",
    method: "get",
    params: { limit },
  });
}
